www.gusucode.com > 云枫工作室企业网站源码 1 > 云枫工作室企业网站源码 1.0/云枫工作室企业网站源码(asp无限制版)1.0/web/admin/Manage_pwd.asp

    <!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<!--#include file="check.asp"-->
<%
Function FormatSQL(strChar)
if strChar="" then
FormatSQL=""
else
FormatSQL=replace(replace(replace(replace(replace(replace(replace(replace(strChar,"'","’"),"*","×"),"?","?"),"(","("),")",")"),"<","〈"),".","。"),";",";")
end if
End Function 
Function SafeRequest(ParaName,ParaType)
       Dim ParaValue
       ParaValue=Request(ParaName)
       If ParaType=1 then
              If not isNumeric(ParaValue) then
                     Response.write "<center>参数" & ParaName & "必须为数字型!</center>"
                     Response.end
              End if
       Else
              ParaValue=replace(ParaValue,"'","''")
       End if
       SafeRequest=ParaValue
End function
%>
<title>修改密码</title>
<%if FormatSQL(SafeRequest("action",0))="save" then%>
<%
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from Manage_admin where admin='"&session("admin")&"'",conn,1,3
if md5(trim(request.form("UserPassword")))<>rs("UserPassword") then
response.Write "<script language=javascript>alert('原密码错误,请返回重新输入');history.go(-1);</script>"
response.End
else
rs("UserPassword")=md5(trim(request.form("UserPassword2")))
rs.Update
rs.Close
set rs=nothing
session("admin")=""
session("rank")=""
response.Write "<script language=javascript>window.alert('[系统提示]\n\n密码修改成功,请重新登陆!');parent.navigate('Admin_login.asp')</script>"
end if
response.End
end if
%>
<html>
<link href="css.css" rel="stylesheet" type="text/css">
<head><script LANGUAGE="javascript">
<!--
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
function check()
{
  if(checkspace(document.renUserPassword.UserPassword.value)) {
	document.renUserPassword.UserPassword.focus();
    alert("[ 系统提示 ]\n\n原密码不能为空!");
	return false;
  }
  if(checkspace(document.renUserPassword.UserPassword1.value)) {
	document.renUserPassword.UserPassword1.focus();
    alert("[ 系统提示 ]\n\n新密码不能为空!");
	return false;
  }
    if(checkspace(document.renUserPassword.UserPassword2.value)) {
	document.renUserPassword.UserPassword2.focus();
    alert("[ 系统提示 ]\n\n确认密码不能为空!");
	return false;
  }
    if(document.renUserPassword.UserPassword1.value != document.renUserPassword.UserPassword2.value) {
	document.renUserPassword.UserPassword1.focus();
	document.renUserPassword.UserPassword1.value = '';
	document.renUserPassword.UserPassword2.value = '';
    alert("[ 系统提示 ]\n\n新密码和确认密码不相同,请重新输入");
	return false;
  }
	document.admininfo.submit();
  }
//-->
</script>
</head>
<body>
<!--#include file="top.htm" --><br>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td height="25" align="center" background="img/menu_manage.gif"><font color="#FFFFFF"><b>更 改 登 陆 密 码</b></font></td>
  </tr>
  <tr> 
    <td bgcolor="#FFFFFF"> 
	<br>
	<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#EBEBEB" class="text">
        <form name="renUserPassword" method="post" action="Manage_pwd.asp?action=save">
          <tr align="center" valign="middle" bgcolor="#FFFFFF"> 
            <td width="20%" height="25">用户名:</td>
            <td width="80%" height="25" align="left"><font color=red><%=session("admin")%></font></td>
          </tr>
          <tr align="center" valign="middle" bgcolor="#FFFFFF"> 
            <td width="20%" height="25">原密码:</div></td>
            <td width="80%" height="25" align="left"><input name="UserPassword" type="Password" id="UserPassword" size="20"></td>
          </tr>
          <tr align="center" valign="middle" bgcolor="#FFFFFF"> 
            <td width="20%" height="25">新密码:</div></td>
            <td width="80%" height="25" align="left"><input name="UserPassword1" type="Password" id="UserPassword1" size="20"></td>
          </tr>
          <tr align="center" valign="middle" bgcolor="#FFFFFF"> 
            <td width="20%" height="25">确认密码:</td>
            <td width="80%" height="25" align="left"><input  name="UserPassword2" type="Password" id="UserPassword2" size="20"></td>
          </tr>
          <tr align="left" bgcolor="#FFFFFF"> 
            <td height="30" colspan="2">            
              <input onClick="return check();" type="submit" name="Submit" value="确定更改">
            <input type="reset" name="Submit2" value="重新输入"></td>
          </tr>
        </form>
    </table>
	<br></td>
  </tr>
</table>
</body>
</html>